package com.woniuxy.oldmanapi.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.oldmanapi.entity.OlderHr;
import com.woniuxy.oldmanapi.mapper.OlderHrMapper;
import com.woniuxy.oldmanapi.vo.HeightVo;
import com.woniuxy.oldmanapi.vo.HrVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HrService {

    @Autowired
    OlderHrMapper olderHrMapper ;

    public PageInfo<HrVo> findHrByPage(Integer now, Integer size, String name) {
        PageHelper.startPage(now,size);
        List<HrVo> HrVoList =  olderHrMapper.selectHrByName(name);
        return new PageInfo<>(HrVoList);
    }

    public void add(OlderHr olderHr) {
        olderHrMapper.insert(olderHr);
    }

    public void delete(int id) {
        olderHrMapper.deleteByPrimaryKey(id);
    }

    public void modify(OlderHr olderHr) {
        olderHrMapper.updateByPrimaryKey(olderHr);
    }
    public HrVo selectOne(int id) {
        return olderHrMapper.selectOneByName(id);
    }
}
